var GlobalData = {





  // get token() {
  //   //验证token是否过期
  //   var time;
  //   wx.getStorage({
  //     key: 'tokenCreateTime',
  //     success: function (res) {
  //       time = res;
  //     }
  //   });
  //   var now = new Date().getTime();
  //   if (now - parseInt(time) > 2500000000) {
  //     wx.setStorage({
  //       key: 'token',
  //       data: "",
  //     });
  //     console.log("token已过期。");
  //   }
  //   var tok;
  //   wx.getStorage({
  //     key: 'token',
  //     success: function (res) {
  //       tok = res;
  //     }
  //   })
  //   return tok;
  // },
  // set token(value) {
  //   wx.setStorage({
  //     key: 'token',
  //     data: value,
  //   });
  //   var time = new Date().getTime();
  //   wx.setStorage({
  //     key: 'tokenCreateTime',
  //     data: time.toString(),
  //   });

  // },


  get account() {
    var accoun;
    wx.getStorage({
      key: 'account',
      success: function (res) {
        accoun = res;
      }
    })
    return accoun;
  },
  set account(value) {
    wx.setStorage({
      key: 'account',
      data: value,
    });
  },

  get password() {
    var pass;
    wx.getStorage({
      key: 'password',
      success: function (res) {
        pass = res;
      }
    })
    return pass;
  },
  set password(value) {
    wx.setStorage({
      key: 'password',
      data: value,
    });
  },

  // 主页数据
  // get homeData() {
  //   var home;
  //   wx.getStorage({
  //     key: 'homeData',
  //     success: function (res) {
  //       home = res;
  //     }
  //   })
  //   return home;
  // },
  // set homeData(value) {
  //   wx.setStorage({
  //     key: 'homeData',
  //     data: value,
  //   });
  // },


  // 账号phone number
  get phoneNumber() {
    var home;
    wx.getStorage({
      key: 'phoneNumber',
      success: function (res) {
        home = res;
        // console.log(res)
      }
    })
    return parseInt(home);
  },
  set phoneNumber(value) {
    wx.setStorage({
      key: 'phoneNumber',
      data: value,
    });
  },

  // 密码
  get passWord() {
    var home;
    wx.getStorage({
      key: 'passWord',
      success: function (res) {
        home = res;
      }
    })
    return home;
  },
  set passWord(value) {
    wx.setStorage({
      key: 'passWord',
      data: value,
    });
  },

}

/**对象拷贝 */
function clone(o) {
  let n;
  if (o instanceof Array) {
    n = [];
    for (let i = 0; i < o.length; ++i) {
      n[i] = clone(o[i]);
    }
    return n;
  } else if (o instanceof Object) {
    n = {}
    for (let i in o) {
      n[i] = clone(o[i]);
    }
    return n;
  } else {
    return o;
  }
}


function getToken() {
  return wx.getStorageSync("token");

}

function setToken(num) {
  wx.setStorageSync("token", num)
  // this._num = num;

}
/**首页 */
var homeData = null
/**  卡种类*/
var KindList = [];
/**  产品下的房卡*/
var ProductList = [];
/**  当前以获取的ID*/
var ProListID = "";
/**购买房卡购物车 */
var shopcar_1 = [];
/**  0为存放卡库，1全部取出*/
var isTakeCard = 0;
/** 购卡记录*/
var BuyCardRecord = [];
/**订单信息 */
var order = {}
/**被支付类型(1充值，2购卡，3直充) */
var PayReason = 0;
/**支付方式 */
var PayType = {};
/**直充购物车 */
var shopcar_2 = [];

/**俱乐部直冲记录 */
var ClubRechargeRecord = [];
/**直充玩家的ID */
var rechargeId = 0;
/**玩家名字 */
var PlayerName = "";
/**俱乐部id */
var clubId = 0;
/**俱乐部名称 */
var ClubName = "";
/**俱乐部创建者 */
var ClubCreateName = "";
/**俱乐部信息 */
var ClubInfo = "";
/** 账户余额明细*/
var BalanceDetail = [];
/**账户余额明细索引 0  1：展示多少条数据2：是否添加*/
var BalanceDetailother = { "index": 1, "size": 20, "add": false };
/**推广收益明细 */
var EarningDetail = [];
/**推广收益明细索引0  1：展示多少条数据2：是否添加*/
var EarningDetailother = { "index": 1, "size": 20, "add": false };
/**个人中心收益信息 */
var PromoteBalanceInfo = {}
/**取卡记录 */
var BuyCardRecord = []
/**取卡记录的请求参数 */
var BuyCardRecordother = { "index": 1, "size": 20, "add": false };
/**购卡直充详情 */
var sysno = ""
/**俱乐部直充记录 */
var ClubRechargeRecord = []
var ClubRechargeRecordother = { "index": 1, "size": 20, "add": false };
/**直冲记录 */
var RechargeRecord = [];
/**游戏直充记录 */
var RechargeRecordother = { "index": 1, "size": 20, "add": false };
/**取卡记录 */
var GetCardRecord = [];
var GetCardRecordother = { "index": 1, "size": 20, "add": false };
/**取卡详情 */
var GetCardDetail = [];
/**取卡详情ID */
var carddetail = 0;
/**卡库分类 */
var DepotKind = [];
/**卡库房卡 */
var DepotCard = [];
var Promotion = [];
/**var */
var processTxt = "";
/**买卡详情 */
var buyCardDetail = {};
/**俱乐部取卡详情 */
var clubOrderdetail = {};
/**直充详情 */
var RechargeRecordDetail = {};
var ispay = false;
var isquKa = false;
/**跳转取卡记录 */
var isjiLu = false;
/**推广流程 */
var istuiLc = false;
/**存卡库 */
var isSave = false;
/**加载 */
var loading = true;
/**注册信息 */
var registerSys = {};
var posterArr = [];
/**是否显示直充 */
var isShowRecharge = false;
/**银行卡信息 */
var bindInfo = [];
/**提现类型 */
var withDrawType = null;




/**积分购物车 */
var shopcarIntegral = [];
/**积分记录 */
var integralRecord = [];
/**获取积分纪录参数 */
var recordinfo = { "index": 1, "size": 20, "add": false };
/**商城地址 */
var urlbp = "";
var allGoods = [];
var mallExchange = [];
var localExchange = [];
/**商品分类 */
var goodsProductList = [];
var discountList = [];
var roomCardList = [];
/**商品列表信息 */
var mallProductList = {};
/**商品类型 ：1商城兑换，0本地兑换 8实物类 9折扣类 10 房卡类*/
var productType;
var producttypeStr = "";
/**商品详情 */
var productDetails;
/**   是否加载更多index数据 获取商品接口的index参数*/
var GoodStyle = {};
/**确认订单的数据 */
var buyInfo = [];
/**兑换总价 */
var price = {};
/**收货地址列表 */
var addressArr = [];
/**收货地址 */
var address;
/**积分商城订单信息 */
var integralOrder;
/**收货地址页面
 * title 0：添加收货地址 其他：编辑收货地址*/
var addressTitle = 0;
/**需要编辑修改的地址 */
var editInfo;
/**最后选中的收货地址 */
var shoppingAddress;
/**积分抽奖选中的收货地址 */
var prixzeAddress;
/**是否直接购买 */
var isdirectbuy = false;
/**兑换记录 */
var exchangeRecord = [];
/**积分记录的类型 all 全部记录 0未付款 1提示发货 2确认收货 3已收货 */
var recordType;
/**获取兑换记录的页数 */
var exchangeRecordPage = {};
var proAllCount = {};
/**积分抽奖记录 */
var inteWinRecord = [];
/**奖品数组 */
var prizeArr = [];
/**奖品id */
var recordid = 0;
/**付款类型 5积分商城支付 */
var PayReason = 0;
/**支付方式 */
var PayType = {};
var picture = [];
var isshowiphone = false;
/**首页轮播图数组 */
var Homeimgurls = [];



/**全局数据 */
var CityData = {
  provinceArr: [],
  citysArr: [],
  areasArr: [],
  hasCity: false,
  dataUrl: 'https://passer-by.com/data_location/list.json',     //数据库地址
  crossDomain: true,       //是否开启跨域
  dataType: 'json',        //数据库类型:'json'或'jsonp'
  provinceField: 'province', //省份字段名
  cityField: 'city',         //城市字段名
  areaField: 'area',         //地区字段名
  valueType: 'code',        //下拉框值的类型,code行政区划代码,name地名
  code: 0,                   //地区编码
  province: 0,              //省份,可以为地区编码或者名称
  city: 0,                   //城市,可以为地区编码或者名称
  area: 0,                   //地区,可以为地区编码或者名称
  required: true,          //是否必须选一个
  nodata: 'hidden',         //当无数据时的表现形式:'hidden'隐藏,'disabled'禁用,为空不做任何处理
  onChange: Function,    //地区切换时触发,回调函数传入地区数据
};
/**释放缓存 */
function Purge() {
  this.homeData = {};
  this.shopcarIntegral = [];
  this.integralRecord = [];
  this.recordinfo = { "index": 1, "size": 20, "add": false };
  this.urlbp = "";
  this.allGoods = [];
  this.mallExchange = [];
  this.localExchange = [];
  this.goodsProductList = [];
  this.discountList = [];
  this.roomCardList = [];
  this.mallProductList = {};
  this.productType = null;
  this.producttypeStr = "";
  this.prizeArr = [];
  this.recordid = null;
  this.inteWinRecord = [];
  this.proAllCount = {};
  this.exchangeRecordPage = {};
  this.recordType = null;
  this.exchangeRecord = [];
  this.isdirectbuy = false;
  this.prixzeAddress = null;
  this.shoppingAddress = null;
  this.editInfo = null;
  this.addressTitle = 0;
  this.integralOrder = null;
  this.address = null;
  this.addressArr = [];
  this.price = {};
  this.buyInfo = [];
  this.GoodStyle = {};
  this.productDetails = null;
}
/**清除记录 */
function destroy() {
  this.withDrawType = 0;
  this.bindInfo = [];
  this.homeData = {}
  /**  卡种类*/
  this.KindList = [];
  /**  产品下的房卡*/
  this.ProductList = [];
  /**  当前以获取的ID*/
  this.ProListID = "";
  /**购买房卡购物车 */
  this.shopcar_1 = [];
  /**  0为存放卡库，1全部取出*/
  this.isTakeCard = 0;
  /** 购卡记录*/
  this.BuyCardRecord = [];
  /**订单信息 */
  this.order = {}
  /**被支付类型(1充值，2购卡，3直充) */
  this.PayReason = 0;
  /**支付方式 */
  this.PayType = {};
  /**直充购物车 */
  this.shopcar_2 = [];

  /**俱乐部直冲记录 */
  this.ClubRechargeRecord = [];
  /**直充玩家的ID */
  this.rechargeId = 0;
  /**玩家名字 */
  this.PlayerName = "";
  /**俱乐部id */
  this.clubId = 0;
  /**俱乐部名称 */
  this.ClubName = "";
  /**俱乐部创建者 */
  this.ClubCreateName = "";
  /**俱乐部信息 */
  this.ClubInfo = "";
  /** 账户余额明细*/
  this.BalanceDetail = [];
  /**账户余额明细索引 0  1：展示多少条数据2：是否添加*/
  this.BalanceDetailother = { "index": 1, "size": 20, "add": false };
  /**推广收益明细 */
  this.EarningDetail = [];
  /**推广收益明细索引0  1：展示多少条数据2：是否添加*/
  this.EarningDetailother = { "index": 1, "size": 20, "add": false };
  /**个人中心收益信息 */
  this.PromoteBalanceInfo = {}
  /**取卡记录 */
  this.BuyCardRecord = []
  /**取卡记录的请求参数 */
  this.BuyCardRecordother = { "index": 1, "size": 20, "add": false };
  /**购卡直充详情 */
  this.sysno = ""
  /**俱乐部直充记录 */
  this.ClubRechargeRecord = []
  this.ClubRechargeRecordother = { "index": 1, "size": 20, "add": false };
  /**直冲记录 */
  this.RechargeRecord = [];
  /**游戏直充记录 */
  this.RechargeRecordother = { "index": 1, "size": 20, "add": false };
  /**取卡记录 */
  this.GetCardRecord = [];
  this.GetCardRecordother = { "index": 1, "size": 20, "add": false };
  /**取卡详情 */
  this.GetCardDetail = [];
  /**取卡详情ID */
  this.carddetail = 0;
  /**卡库分类 */
  this.DepotKind = [];
  /**卡库房卡 */
  this.DepotCard = [];
  this.Promotion = [];
  /**var */
  this.processTxt = "";
  /**买卡详情 */
  this.buyCardDetail = {};
  /**俱乐部取卡详情 */
  this.clubOrderdetail = {};
  /**直充详情 */
  this.RechargeRecordDetail = {};
  this.ispay = false;
  this.isquKa = false;
  /**跳转取卡记录 */
  this.isjiLu = false;
  /**推广流程 */
  this.istuiLc = false;
  /**存卡库 */
  this.isSave = false;
  /**加载 */
  this.loading = true;
  /**注册信息 */
  this.registerSys = {};
  this.posterArr = [];
  /**是否显示直充 */
  this.isShowRecharge = false;
}
module.exports = {
  destroy: destroy,
  homeData: homeData,
  GlobalData: GlobalData,
  clone: clone,
  Purge: Purge,
  shopcarIntegral: shopcarIntegral,
  integralRecord: integralRecord,
  recordinfo: recordinfo,
  urlbp: urlbp,
  Homeimgurls: Homeimgurls,

  allGoods: allGoods,
  mallExchange: mallExchange,
  localExchange: localExchange,
  goodsProductList: goodsProductList,
  discountList: discountList,
  roomCardList: roomCardList,


  mallProductList: mallProductList,
  productType: productType,
  producttypeStr: producttypeStr,
  productDetails: productDetails,
  GoodStyle: GoodStyle,
  buyInfo: buyInfo,
  price: price,
  addressArr: addressArr,
  address: address,
  integralOrder: integralOrder,
  addressTitle: addressTitle,
  editInfo: editInfo,
  shoppingAddress: shoppingAddress,
  prixzeAddress: prixzeAddress,
  isdirectbuy: isdirectbuy,
  exchangeRecord: exchangeRecord,
  recordType: recordType,
  exchangeRecordPage: exchangeRecordPage,
  proAllCount: proAllCount,
  inteWinRecord: inteWinRecord,
  prizeArr: prizeArr,
  recordid: recordid,
  setToken: setToken,
  getToken: getToken,
  PayReason: PayReason,
  CityData: CityData,
  PayType: PayType,
  picture: picture,


  // 售卡
  KindList: KindList,
  clone: clone,
  ProductList: ProductList,
  ProListID: ProListID,
  shopcar_1: shopcar_1,
  isTakeCard: isTakeCard,
  BuyCardRecord: BuyCardRecord,
  order: order,
  PayReason: PayReason,
  PayType: PayType,
  shopcar_2: shopcar_2,
  RechargeRecord: RechargeRecord,
  ClubRechargeRecord: ClubRechargeRecord,
  rechargeId: rechargeId,
  ClubName: ClubName,
  ClubCreateName: ClubCreateName,
  clubId: clubId,
  ClubInfo: ClubInfo,
  BalanceDetail: BalanceDetail,
  BalanceDetailother: BalanceDetailother,
  EarningDetail: EarningDetail,
  EarningDetailother: EarningDetailother,
  PromoteBalanceInfo: PromoteBalanceInfo,
  BuyCardRecord: BuyCardRecord,
  BuyCardRecordother: BuyCardRecordother,
  sysno: sysno,
  ClubRechargeRecordother: ClubRechargeRecordother,
  RechargeRecordother: RechargeRecordother,
  GetCardRecord: GetCardRecord,
  GetCardRecordother: GetCardRecordother,
  carddetail: carddetail,
  GetCardDetail: GetCardDetail,
  DepotKind: DepotKind,
  DepotCard: DepotCard,
  Promotion: Promotion,
  processTxt: processTxt,
  buyCardDetail: buyCardDetail,
  clubOrderdetail: clubOrderdetail,
  RechargeRecordDetail: RechargeRecordDetail,
  ispay: ispay,
  isquKa: isquKa,
  isjiLu: isjiLu,
  istuiLc: istuiLc,
  homeData: homeData,
  isSave: isSave,
  loading: loading,
  registerSys: registerSys,
  posterArr: posterArr,
  isShowRecharge: isShowRecharge,
  bindInfo: bindInfo,
  withDrawType: withDrawType
}